-
-
Notifications
You must be signed in to change notification settings - Fork 245
feat: implement conventional commits with commitlint validation #2686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
- Add @commitlint/cli and @commitlint/config-conventional dependencies - Create commitlint.config.js with conventional commit rules - Set up Husky commit-msg hook for automatic validation - Update documentation with conventional commit guidelines - Add tests to verify commitlint configuration - Add commitlint script to package.json for manual validation The implementation supports all standard conventional commit types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert Commit messages are automatically validated on commit to ensure they follow the conventional commits specification. Co-authored-by: mrlubos <[email protected]>
@@ -0,0 +1 @@ | |||
npx --no-install commitlint --edit "$1" No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dosu explain to me whether this will run offline as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot explain to me whether this will run offline as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the hook will run offline! The implementation uses npx --no-install commitlint
which ensures it only uses locally installed dependencies and won't attempt to download packages from the internet.
How it works offline:
- When developers run
pnpm install
, commitlint and its dependencies are installed locally - The hook uses
npx --no-install
which restricts npx to only use already-installed packages - If commitlint isn't installed locally, the hook will fail with a clear error rather than trying to download it
Requirements for offline use:
- Dependencies must be installed first with
pnpm install
- Both
@commitlint/cli
and@commitlint/config-conventional
need to be available locally
This approach ensures the hook works reliably in offline environments, CI systems, or any scenario where internet access might be restricted. The commit accedb8 addresses this specifically.
This PR implements Conventional Commits support for the repository following the specification at https://www.conventionalcommits.org/en/v1.0.0/.
What Changed
Dependencies
@commitlint/[email protected]
for commit message validation@commitlint/[email protected]
for standard conventional commit rulesConfiguration
commitlint.config.js
with comprehensive rules supporting all standard commit types.husky/commit-msg
hook for automatic validation on every commit with offline supportcommitlint
script to package.json for manual validationDocumentation
Testing
How It Works
All commit messages are now automatically validated using commitlint when developers make commits. The validation supports all standard conventional commit types:
feat:
- New featuresfix:
- Bug fixesdocs:
- Documentation changesstyle:
- Code style changes (formatting, etc.)refactor:
- Code refactoringperf:
- Performance improvementstest:
- Adding or updating testsbuild:
- Build system changesci:
- CI/CD configuration changeschore:
- Maintenance tasksrevert:
- Reverting previous commitsOffline Support
The implementation works reliably in offline environments. The commit hook uses
npx --no-install commitlint
which ensures it only uses locally installed dependencies and won't attempt to download packages from the internet. This makes the hook work in offline environments, restricted networks, or CI systems as long as dependencies have been installed viapnpm install
.Examples
✅ Valid commit messages:
❌ Invalid commit messages:
Benefits
The implementation is minimal and doesn't disrupt existing workflows - it only adds validation to ensure commit messages follow the conventional format.
Fixes #2685.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.